package com.mediacloud.app.newsmodule.fragment.simulcast

import android.text.TextUtils
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.eventTrack.CDPTrackReportManager
import com.facebook.drawee.view.SimpleDraweeView
import com.mediacloud.app.assembly.util.loadByFresco
import com.mediacloud.app.model.news.ArticleItem
import com.mediacloud.app.newsmodule.R

class SimulcastMoreAdapter : BaseQuickAdapter<ArticleItem,BaseViewHolder>(R.layout.item_zs) {
    override fun convert(helper: BaseViewHolder, item: ArticleItem) {
        val logo = helper.getView<SimpleDraweeView>(R.id.logo)
        val tvtitle = helper.getView<TextView>(R.id.tvtitle)
        val tvSourseAndTime = helper.getView<TextView>(R.id.tvSourseAndTime)
        logo.loadByFresco(item.logo)
        tvtitle.text = item.title
        if (TextUtils.isEmpty(item.referName)){
            tvSourseAndTime.text = "${logo.context.resources.getString(R.string.app_name)}  ${item.publishDate}"
        }else{
            tvSourseAndTime.text = "${item.referName}  ${item.publishDate}"
        }
        CDPTrackReportManager.getInstance().NewsRPExpose(helper.absoluteAdapterPosition,item,"本期资讯")
        helper.setVisible(R.id.ivIcon, true)
        helper.setVisible(R.id.videoTime, true)
        helper.setText(R.id.videoTime,item.prop4)
    }
}